# include <stdio.h>
# include <stdlib.h>
# include <string.h>

char* cat_str (char* str1, char* str2, char* str12){
    size_t len1 = strlen(str1), len2=strlen(str2);
    if (strlen(str12)< len1+len2+1){
		if (realloc(str12,  len1+len2+2)==NULL){
			printf("Error in resize the string!");
			exit(12); 
		}
	}
        
    strcpy(str12, str1);
    str12[len1] = ' ';
    strcpy(str12+len1+1, str2);
	return str12;
}

int main(){

	char* name = "Rong Xiao";
	char* str = (char*) malloc(8);


	printf("Length of \"%s\" is %ld\n", name, strlen(name));

	cat_str(name, "is good!", str);

	printf("Length of %s is %ld\n", str, strlen(str));
	
	free(str);
	return 0;

}
